package com.dwd.hrm.util;

import com.alibaba.fastjson.JSON;
import com.dwd.hrm.vo.UserContext;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 * @Description: TODO
 * @Author 汶狄
 * @Date 2021/3/15 11:54
 * @Version 1.0
 */
public class UserContextHolder {
    public static UserContext get() {
        String userContext = SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString();
        UserContext userContext1 = JSON.parseObject(userContext, UserContext.class);
        return userContext1;
    }
}
